<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\CommentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->registerCssFile('@web/css/backstage.css',['depends'=>['app\assets\AppAsset']]);
$this->title = 'Comments';
$this->params['breadcrumbs'][] = $this->title;
$this->registerJsFile('@web/js/setHeight.js',['depends'=>['app\assets\AppAsset']]);
?>
    <div class="box">
        <div class="comment-index">
            <div class="main"><!--右侧内容-->
                <div class="cont">
                    <div class="title">题解概况</div>
                    <div class="details">
                        <div class="details_operation clearfix">
                            <div class="bui_select">
<!--                               <input type="button" value="" class="add">-->
                                <?php //Html::a('添加', ['create'], ['class' => 'btn add']) ?>
                            </div>
                            <div class="fr">
                                <div class="text">
                                    <span>日期：</span>
                                    <div class="bui_select">
                                        <select name="" id="" class="select">
                                            <option value="1"><?= date("Y-m-d "); ?></option>
                                        </select>
                                    </div>
                                </div>
                                <div class="text">
                                    <span></span>
                                    <div class="bui_select">
                                        <select name="" id="" class="select">
                                            <option value="1">Life without a friend is death.</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="text">
                                    <span></span>
                                    <!--                            <input type="text" value="" class="search">-->
                                </div>
                            </div>
                        </div>
                        <table class="table" cellspacing="0" cellpadding="0">
                            <thead>
                            </thead>
                            <tbody>
                            <tr>
                                <td><h3><?=Html::encode($this->title)?></h3></td>
                            </tr>
                            <tr>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            [
                'class' => 'yii\grid\DataColumn', //由于是默认类型，可以省略
                'attribute' => "用户",
                'value' => function ($data) {
                    $data1 = \app\models\User::findone($data->user_id)->name;
                    return $data1; // 如果是数组数据则为 $data['name'] ，例如，使用 SqlDataProvider 的情形。
                },
            ],
            'question_id',
            'comment_content:ntext',
            'url:url',
            // 'comment_time',
            // 'class1_id',
            // 'class2_id',
            // 'like_num',
            // 'play_num',
            // 'like_ids',
            [
                'class' => 'yii\grid\DataColumn', //由于是默认类型，可以省略
                'attribute' => "是否置顶",
                'value' => function ($data) {
                    if($data->is_up==0){
                        return "否";
                    }else {
                        return "是"; // 如果是数组数据则为 $data['name'] ，例如，使用 SqlDataProvider 的情形。
                    }
                },
            ],

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
